import Main from '../views/main.vue'
import SystemRouter from './SystemRouter'
import MallRouter from './MallRouter'
import DemoRouter from './DemoRouter'
import BigDataRouter from './BigDataRouter'
import PlatformRouter from './PlatformRouter'

/**
 * 路由配置说明
 * 通过配置meta决定是否显示在侧边栏菜单上
 * meta除了原生参数外可配置的参数:
 * meta: {
 *      title: { String|Number|Function }
 *          显示在侧边栏、面包屑和标签栏的文字
 *          使用'{{ 多语言字段 }}'形式结合多语言使用
 *      hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *      hideInBread: (false) 设为true后此级路由将不会出现在面包屑中
 *      hideInTags: (false) 设为true后此级路由将不会出现在TagNav导航中
 *      access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *      icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标
 *      href: 'https://www.xxx.com' (default: null) 用于跳转到外部连接
 *      iframe: false  用于跳转到外部连接，打开新的页面
 *      iframe: true  用于跳转到外部连接，在tab中打开外部连接，需设置component: IFrame
 *      level: 1/2
 *          level 属性在一级菜单中设置，不添加level属性默认二级菜单为一级菜单
 *          1：如果一级菜单下有二级菜单，并且只有一个二级菜单，将二级菜单变为一级菜单
 *          2：如果一级菜单下有二级菜单，并且只有一个二级菜单，原样显示为二级菜单
 * }
 */


/**
 * 主页，框架
 */
const Home = {
    path: '/',
    name: 'main',
    meta: {hideInMenu: true},
    component: Main,
    redirect: '/home/console',
}

/**
 * 控制台，进入主页打开的第一个页面
 */
const Dashboard = {
    path: '/home',
    name: 'home',
    meta: {
        title: '首页',
        icon: 'el-icon-menu',
        hideInMenu: false
    },
    component: Main,
    children: [
        {
            path: 'console',
            name: 'console',
            meta: {
                title: '主控台',
                icon: 'el-icon-menu',
                hideInMenu: false
            },
            component: () => import('@/views/dashboard/console/index.vue'),
        },
        // {
        //     path: 'monitor',
        //     name: 'monitor',
        //     meta: {
        //         title: '监控台',
        //         icon: 'el-icon-menu',
        //         hideInMenu: false
        //     },
        //     component: () => import('@/views/dashboard/monitor/index.vue'),
        // },
        // {
        //     path: 'workplace',
        //     name: 'workplace',
        //     meta: {
        //         title: '工作台',
        //         icon: 'el-icon-menu',
        //         hideInMenu: false
        //     },
        //     component: () => import('@/views/dashboard/workplace/index.vue'),
        // }
    ]
}

/**
 * 登录
 */
const Login = {
    path: '/login',
    name: 'login',
    meta: {hideInMenu: true},
    component: () => import('@/views/login/login.vue'),
}

/**
 * 忘记密码
 */
const Forget = {
    path: '/forget',
    name: 'forget',
    meta: {hideInMenu: true},
    component: () => import('@/views/forget/forget.vue'),
}

/**
 * 异常路由
 */
const Exception = {
    path: '/exception',
    name: 'exception',
    meta: {hideInMenu: true},
    component: Main,
    children: [
        {
            path: '403',
            name: '403',
            meta: {hideInMenu: true},
            component: () => import('@/views/exception/403.vue'),
        },
        {
            path: '404',
            name: '404',
            meta: {hideInMenu: true},
            component: () => import('@/views/exception/404.vue')
        },
        {
            path: '500',
            name: '500',
            meta: {hideInMenu: true},
            component: () => import('@/views/exception/500.vue')
        }
    ]
}

/**
 * 404找不到页面
 * 添加到路由最后
 */
const NotFoundPage = {
    path: '/:pathMatch(.*)*',
    name: 'NotFoundPage01',
    meta: {
        hideInMenu: true
    },
    component: Main,
    redirect: '/exception/404'
}

/**
 * 基础路由
 */
const BaseRouter = [
    Home,
    Dashboard,
    Login,
    Forget,
    Exception
]

export default [
    ...BaseRouter,
    ...MallRouter,
    // ...PlatformRouter,
    ...SystemRouter,
    // ...DemoRouter,
    // ...BigDataRouter,
    NotFoundPage
]
